package demo2_simple_data_struct;

public class LoopNode {
    //节点内容
    private  int data;
    //下一个节点
    LoopNode next;
    public LoopNode(int data) {
        this.data = data;
        next=this;
    }


    //获取下一个节点
    public LoopNode next(){
        return this.next;
    }

    //获取节点中的数据
    public  int getData(){
        return  this.data;
    }

    public void  removeNext(){
        LoopNode newNode = next.next;
        this.next = newNode;
    }
    //当前节点后面插入节点
    public void  after(LoopNode node){
        //取出下一个节点
        LoopNode nextNode = next;
        //把新节点作为当前节点的下一个节点
        this.next = node;
        node.next = nextNode;
    }

}
